home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Tcl / UserCode / selectFunc.tcl < prev    next >
Text File  |  1994-03-08  |  1KB  |  51 lines

  1. # FILE: selectFunc.tcl
  2. #
  3. # LAST UPDATE: 2/1/93 12:15:28 PM
  4. #
  5. #    selectFunc - similar to searchFunc, but selects the entire definition
  6.  
  7. # COPYRIGHT:
  8. #
  9. #    Copyright ⌐ 1993 by David C. Black
  10. #    All rights reserved.
  11. #
  12. #    Redistribution and use in source and binary forms are permitted
  13. #    provided that the above copyright notice and this paragraph are
  14. #    duplicated in all such forms and that any documentation,
  15. #    advertising materials, and other materials related to such
  16. #    distribution and use acknowledge that the software was developed
  17. #    by David C. Black.
  18. #
  19. #    THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  20. #    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  21. #    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  22. #
  23. #############################################################################
  24.  
  25. proc selectFunc {dir} {
  26.     global funcExpr
  27.     set pos [getPos]
  28.     select $pos
  29.     if {$dir==1} {
  30.         incr pos
  31.     } else {
  32.         set pos [expr $pos-1]
  33.     }
  34.     if {[catch {eval select [search -f $dir -i 1 -r 1 $funcExpr $pos]}]} {
  35.         beep
  36.         message "No more functions"
  37.     } else {
  38.         set pos [getPos]
  39.         set end [selEnd]
  40.         if {[catch {eval select [search -f 1 -i 1 -r 1 $funcExpr $end]}]} {
  41.             select $pos [maxPos]
  42.         } else {
  43.             set end [getPos]
  44.             select $pos $end
  45.         }
  46.     }
  47. }
  48. #endproc selectFunc
  49. ##############################################################################
  50.  
  51.